<template>
  <div class="myHome">
    <el-container>
      <el-header>组件库</el-header>
      <el-container>
        <el-aside width="200px">
          <el-menu :default-active="this.$route.path" class="el-menu-vertical-demo">
            <template v-for="(item, index) in navList">
              <el-menu-item :index="item.url" @click="navRouter(item.url)">
                <i :class="item.icon"></i>
                <template #title>{{ item.name }}</template>
              </el-menu-item>
            </template>
          </el-menu>
        </el-aside>
        <el-main>
          <router-view/>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  name: 'HomeView',
  components: {},
  data () {
    return {
      navList: [
        {name: '图片查看组件', index: '1', icon: 'el-icon-menu', url: '/photo/index'},
        {name: '轻提示组件', index: '2', icon: 'el-icon-menu', url: '/layer/index'},
        {name: '省市区联动组件', index: '3', icon: 'el-icon-menu', url: '/zoning/index'},
        {name: '图片查看组件2', index: '2', icon: 'el-icon-menu', url: '/photo2/index'},
      ]
    }
  },
  methods: {
    navRouter (url) {
      this.$router.push({
        path: url,
      })
    },
  }
}
</script>
